function enableSubmit(bool){
if(bool)$("#submit").removeAttr("disabled");
else $("#submit").attr("disabled","disabled");
}
function v_submitbutton(){
	if($("#agree").attr("checked")!="checked") {
		enableSubmit(false);
		$(".readagreement-wrap").css("outline","1px solid #f99");
		return;
	}else{$(".readagreement-wrap").css("outline","1px solid #9f9");}
	for(f in flags) if(!flags[f]) {enableSubmit(false); return;}
	enableSubmit(true);
}
var flags = [false,false];
function lineState(name,state,msg){
if(state=="none"){$("#line_"+name+" .input div").attr("class","none"); return;}
if(state=="corect"){$("#line_"+name+" .input div").attr("class","corect");return;}
$("#line_"+name+" .input span").text(msg);$("#line_"+name+" .input div").attr("class","error");
}
function v_name(){
var name = $("#name").val();
if(name.length==0) {lineState("name","error","不得为空"); flags[0]=false;}
else{
if(name.length>32) {lineState("name","error","必须少于32个字符"); flags[0]=false;}
else{lineState("name","corect",""); flags[0] = true;}
}
v_submitbutton();
}
function v_password(){
var password = $("#password").val();
if(password.length<6) {lineState("password","error","必须多于或等于6个字符"); flags[1]=false;}
else{
if(password.length>16){lineState("password","error","必须少于或等于16个字符"); flags[1]=false;}
else{
lineState("password","corect","");
flags[1] = true;
}
}
v_submitbutton();
}
function adaptValue(){
	if(flags[0]==true&&flags[1]==true){
		return true;
	}else{
		return false;
	}
}
